'''
Created on 2010-6-12

@author: wangjo
'''
import utility
import model
import logging

class IndexHandler(utility.BaseRequestHandler):
    def get(self):
        logging.info("Android Index Handler")
        apps = model.android.get_all_apps(False)
        if len(apps) == 1:
            app = apps[0]
            self.redirect("/android/%s"%app.name)
        else:
            self.generate('android.index.html', {'app_name':'Android - Taobility Software',
                                             'selected' : 'android',
                                             'apps': apps, })

class AppHandler(utility.BaseRequestHandler):
    def get(self, appname):
        app = model.android.get_app(appname)
        screens = app.get_screens()
        self.generate("android.base.html", {'app_name':'%s - Taobility Software'%app.displayname,
                                            'selected' : 'android',
                                            'app': app,
                                            'screens':screens, })